package com.springboot.file.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.springboot.file.converter.DeleteFlagConverter;
import com.springboot.file.util.easyexcel.annotation.ExcelValidate;
import com.springboot.file.util.easyexcel.converter.CustomBigDecimalConverter;
import com.springboot.file.util.easyexcel.converter.CustomLocalDateConverter;
import com.springboot.file.util.easyexcel.converter.CustomNumberConverter;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 发票清单信息
 *
 * @author liuc
 * @since 2025-04-14
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("invoice_detail_record")
public class InvoiceDetailRecord implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "id")
    @ExcelIgnore
    private String id;

    /**
     * 发票编号
     */
    @TableField("invoice_no")
    @ExcelProperty(index = 0, value = "发票编号")
    private String invoiceNo;

    /**
     * 会计年度
     */
    @TableField("financial_year")
    @ExcelProperty(index = 1, value = "会计年度")
    private String financialYear;

    /**
     * 发票代码
     */
    @TableField("Invoice_code")
    @ExcelProperty(index = 2, value = "发票代码")
    @ExcelValidate(fieldName = "发票代码", required = true)
    private String invoiceCode;

    /**
     * 发票号码
     */
    @TableField("invoice_number")
    @ExcelProperty(index = 3, value = "发票号码")
    private String invoiceNumber;

    /**
     * 付款公司名称
     */
    @TableField("pay_company_name")
    @ExcelProperty(index = 4, value = "付款公司名称")
    private String payCompanyName;

    /**
     * 开票（收款）公司名称
     */
    @TableField("receive_company_name")
    @ExcelProperty(index = 5, value = "开票（收款）公司名称")
    private String receiveCompanyName;

    /**
     * 合同名称
     */
    @TableField("contract_name")
    @ExcelProperty(index = 6, value = "合同名称")
    private String contractName;

    /**
     * 合同编号
     */
    @TableField("contract_no")
    @ExcelProperty(index = 7, value = "合同编号")
    private String contractNo;

    /**
     * 收货单编号
     */
    @TableField("receipt_number")
    @ExcelProperty(index = 8, value = "收货单编号")
    private String receiptNumber;

    /**
     * 应付账款凭证编号
     */
    @TableField("need_pay_acc_evidence_code")
    @ExcelProperty(index = 9, value = "应付账款凭证编号")
    private String needPayAccEvidenceCode;

    /**
     * 发票类型
     */
    @TableField("invoice_type")
    @ExcelProperty(index = 10, value = "发票类型")
    private String invoiceType;

    /**
     * 挂账事由
     */
    @TableField("charge_reason")
    @ExcelProperty(index = 11, value = "挂账事由")
    private String chargeReason;

    /**
     * 付款条件代码
     */
    @TableField("payment_term_code")
    @ExcelProperty(index = 12, value = "付款条件代码")
    private String paymentTermCode;

    /**
     * 付款条件说明
     */
    @TableField("payment_term_desc")
    @ExcelProperty(index = 13, value = "付款条件说明")
    private String paymentTermDesc;

    /**
     * 付款方式
     */
    @TableField("payment_method")
    @ExcelProperty(index = 14, value = "付款条件说明")
    private String paymentMethod;

    /**
     * 币种
     */
    @TableField("currency")
    @ExcelProperty(index = 15, value = "币种")
    private String currency;

    /**
     * 税率
     */
    @TableField("tax_rate")
    @ExcelProperty(index = 16, value = "税率", converter = CustomNumberConverter.class)
    private BigDecimal taxRate;

    /**
     * 发票备注
     */
    @TableField("invoice_remark")
    @ExcelProperty(index = 17, value = "发票备注")
    private String invoiceRemark;

    /**
     * 删除标志（0-否，1-是）
     */
    @TableField("delete_flag")
    @ExcelProperty(index = 18, value = "删除标志",converter = DeleteFlagConverter.class)
    private String deleteFlag;

    /**
     * 开票日期
     */
    @TableField("invoice_date")
    @ExcelProperty(index = 19, value = "开票日期",converter = CustomLocalDateConverter.class)
    private LocalDate invoiceDate;

    /**
     * 挂账日期
     */
    @TableField("charge_date")
    @ExcelProperty(index = 20, value = "挂账日期",converter = CustomLocalDateConverter.class)
    private LocalDate chargeDate;

    /**
     * 账期
     */
    @TableField("account_date")
    @ExcelProperty(index = 21, value = "account_date",converter = CustomLocalDateConverter.class)
    private LocalDate accountDate;

    /**
     * 含税金额
     */
    @TableField("tax_inclusive_amount")
    @ExcelProperty(index = 22, value = "含税金额", converter = CustomBigDecimalConverter.class)
    private BigDecimal taxInclusiveAmount;

    /**
     * 不含税金额
     */
    @TableField("excluding_tax_amount")
    @ExcelProperty(index = 23, value = "不含税金额", converter = CustomBigDecimalConverter.class)
    private BigDecimal excludingTaxAmount;

    /**
     * 税额
     */
    @TableField("tax_amount")
    @ExcelProperty(index = 24, value = "税额", converter = CustomBigDecimalConverter.class)
    private BigDecimal taxAmount;

    /**
     * 已付金额
     */
    @TableField("paid_amount")
    @ExcelProperty(index = 25, value = "已付金额", converter = CustomBigDecimalConverter.class)
    private BigDecimal paidAmount;

    /**
     * 应付金额
     */
    @TableField("payable_amount")
    @ExcelProperty(index = 26, value = "应付金额", converter = CustomBigDecimalConverter.class)
    private BigDecimal payableAmount;

    /**
     * 收款账号
     */
    @TableField("receive_account_no")
    @ExcelProperty(index = 27, value = "收款账号")
    private String receiveAccountNo;

    /**
     * 开户银行行号
     */
    @TableField("open_bank_no")
    @ExcelProperty(index = 28, value = "开户银行行号")
    private String openBankNo;

    /**
     * 预计付款日期
     */
    @TableField("expected_payment_date")
    @ExcelProperty(index = 29, value = "预计付款日期",converter = CustomLocalDateConverter.class)
    private LocalDate expectedPaymentDate;

    /**
     * 预计付款方式
     */
    @TableField("expected_payment_method")
    @ExcelProperty(index = 30, value = "预计付款方式")
    private String expectedPaymentMethod;

    /**
     * 价税合计
     */
    @TableField("price_tax_total")
    @ExcelProperty(index = 31, value = "价税合计", converter = CustomBigDecimalConverter.class)
    private BigDecimal priceTaxTotal;

    /**
     * 来源单据号
     */
    @TableField("source_doc_no")
    @ExcelProperty(index = 32, value = "来源单据号")
    private String sourceDocNo;

    /**
     * 预报订单号
     */
    @TableField("forecast_order_no")
    @ExcelProperty(index = 33, value = "预报订单号")
    private String forecastOrderNo;

    /**
     * 创建人
     */
    @TableField("create_by")
    @ExcelIgnore
    private String createBy;

    /**
     * 更新人
     */
    @TableField("update_by")
    @ExcelIgnore
    private String updateBy;

    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @ExcelIgnore
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    @ExcelIgnore
    private LocalDateTime updateTime;


} 